<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.css" />
		<link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css" />
		<link rel="stylesheet" type="text/css" href="../css/pages/perfectUser.css" />
	</head>

	<body>
		<div id="app">
			<div class="content">
				<div class="itemClass">
					<input v-model="name" type="text" placeholder="请填写业主真实姓名" />
				</div>
				<div class="itemClass">
					<input v-model="idCard" type="number" placeholder="填写身份证号码" />
				</div>
			</div>

			<div class="button-list">
				<div class="hint">
					确认核实业主信息，可享受物业缴费、投诉报修、小区拼车、业主分享等功能
				</div>
				<div class="succeed" @click="succeedClick">完成</div>
			</div>
		</div>

		<script src="../js/Width.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/vue.js"></script>
		<script src="../js/mui.picker.js"></script>
		<script src="../js/mui.poppicker.js"></script>
		<script src="../js/Util.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
		<script type="text/javascript">
			mui.init({
				beforeback: function() {
					//获得列表界面的webview
					var list = plus.webview.currentWebview().opener();
					//触发列表界面的自定义事件（refresh）,从而进行数据刷新
					mui.fire(list, 'perfectUser');
					//返回true，继续页面关闭逻辑
					return true;
				}
			})
			var Community = new mui.PopPicker(); // 报事部门
			mui.plusReady(function() {
				if (mui.os.ios) { //判断是ios还是安卓设备
				FastClick.attach(document.body);
					ws = plus.webview.currentWebview();
				}
				if (mui.os.android) {
					//安卓按两次关闭app
					var clickNum = 0;
					mui.back = function(event) {
						clickNum++;
						if (clickNum == 2) {
							plus.runtime.quit();
						} else {
							mui.toast("再按一次退出应用");
						}
						setTimeout(function() {
							clickNum = 0;
						}, 1500);
						return false;
					}
				}
			})
			
			var app = new Vue({
				el: '#app',
				data: {
					name: '',
					idCard: ''
				},
				methods: {
					
					succeedClick: function() {
						var that = this;
						if (this.name && this.idCard) {
							
							plus.nativeUI.showWaiting('加载中', {
								width: '100px',
								height: '100px'
							});
							var userID = Util.getState('$state').userID // 获取用户ID
							
							mui.post(Util.HTTP + 'api/Users/Authentication', {
								userID: userID, //账号ID
								proName: that.name, //业主真实姓名
								proCertificateNumber: that.idCard  //身份证号
							}, function(res) {
								plus.nativeUI.closeWaiting();
								mui.toast(res.message)
								if (res.code == 1001) {
									Util.setState('$userState', true)
									setTimeout(function() {
										mui.openWindow({
											url: '../pages/user/myhous.html',
											id: 'myhous',
											styles: { // 窗口参数 参考5+规范中的WebviewStyle,也就是说WebviewStyle下的参数都可以在此设置
												titleNView: { // 窗口的标题栏控件
													titleText: "房屋信息", // 标题栏文字,当不设置此属性时，默认加载当前页面的标题，并自动更新页面的标题         // 字体颜色,颜色值格式为"#RRGGBB",默认值为"#000000"
													titleSize: "17px", // 字体大小,默认17px
													backgroundColor: "#ffffff", // 控件背景颜色,颜色值格式为"#RRGGBB",默认值为"#F7F7F7"
													splitLine: { // 标题栏控件的底部分割线，类似borderBottom
														color: "#eeeeee", // 分割线颜色,默认值为"#CCCCCC"  
														height: "1px"// 分割线高度,默认值为"2px"
													}
												}
											},
											show: {
												aniShow: 'pop-in'
											},
											waiting: {
												autoShow: false
											}
										})
									}, 1000)
								}
							})
						} else {
							mui.toast('您的信息尚未填写完整')
						}
					}
				}
			})
		</script>
	</body>

</html>

